chain rule twice to take the derivative